﻿using System;
using UnityEngine;
using Yoozoo.HRP.Runtime;

namespace Yoozoo.Gameplay.Liberty.Hud
{
    public class StreetHudComponent : MonoBehaviour
    {
        private void LateUpdate()
        {
            HCamera hCamera = HCameraManager.GetBaseCamera();
            if (hCamera && hCamera.Camera)
            {
                Vector3 relativePos = -hCamera.Camera.transform.forward;//transform.position - hCamera.Camera.transform.position;
                Quaternion lookAt = Quaternion.LookRotation(relativePos, Vector3.up);
                transform.eulerAngles =
                    new Vector3(transform.eulerAngles.x, 
                        lookAt.eulerAngles.y,
                        transform.eulerAngles.z);

            }
        }
    }
}